package coreModel;

import reports.directors.IVisitor;
import hitExceptions.InvalidDataException;

/**
 * This class is just a wrapper around the abstract class Product Container
 * @author Fantastic 4
 * 
 */
@SuppressWarnings("serial")
public class StorageUnit extends ProductContainer 

{

	/**
	 * Constructer 	
	 */
	public StorageUnit(String name) throws InvalidDataException
	{
		super(name);
	}
	
	@Override
	public boolean equals(Object obj)
	{
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		if (this.getName().equals(((StorageUnit)obj).getName()))
			return true;
		else 
			return false;
		
		
	}

	@Override
	public void preOrderAccept(IVisitor visitor)
	{
		visitor.visit(this);
		for(ProductGroup pg: this.getChildren())
		{
			pg.preOrderAccept(visitor);
		}
	}
	
	@Override
	public void postOrderAccept(IVisitor visitor)
	{
		for(ProductGroup pg: this.getChildren())
		{
			pg.postOrderAccept(visitor);
		}
		visitor.visit(this);
		
	}
}
